///////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#ifndef __INPUT_MANAGER_H__
#define __INPUT_MANAGER_H__

//-----------------------------------------------------------------------------

#include <Config.h>
#include <AbstractManager.h>
#include <vector>
#include <string>

using namespace std;

#define		KEY_VECTOR_SIZE		(256)
#define		MOUSE_BUTTONS		(3)

//-----------------------------------------------------------------------------

class InputManager
	: public AbstractManager<InputManager>
{
private:
	//keys
	bool									m_keyDown1[ KEY_VECTOR_SIZE ];
	bool									m_keyPressed1[ KEY_VECTOR_SIZE ];
	bool									m_keyReleased1[ KEY_VECTOR_SIZE ];

	bool									m_keyDown[ KEY_VECTOR_SIZE ];
	bool									m_keyPressed[ KEY_VECTOR_SIZE ];
	bool									m_keyReleased[ KEY_VECTOR_SIZE ];

	//mouse
	s32										m_mouseX;
	s32										m_mouseY;
	s32										m_mouseXOffset;
	s32										m_mouseYOffset;

	bool									m_mouseButtonsDown[ MOUSE_BUTTONS ];
	bool									m_mouseButtonsPressed[ MOUSE_BUTTONS ];
	bool									m_mouseButtonsReleased[ MOUSE_BUTTONS ];

	bool									m_mouseButtonsDown1[ MOUSE_BUTTONS ];
	bool									m_mouseButtonsPressed1[ MOUSE_BUTTONS ];
	bool									m_mouseButtonsReleased1[ MOUSE_BUTTONS ];

public:
											InputManager();
	virtual									~InputManager();

	void									ResetInput();
	void									Update();

	//keys
	bool									IsKeyDown( u8 key );
	bool									KeyPressed( u8 key );
	bool									KeyReleased( u8 key );

	void									GetInput( bool down, u8 key, int x, int y );

	//mouse
	void									GetMouseClick( s32 button, bool state, s32 x, s32 y );
	void									GetMouseMove( s32 x, s32 y );

	bool									HasMouseMoved();
	s32										GetMousePositionX();
	s32										GetMousePositionY();
	s32										GetMouseOffsetX();
	s32										GetMouseOffsetY();
	bool									IsMouseButtonDown( s32 button );
	bool									IsMouseButtonPressed( s32 button );
	bool									IsMouseButtonReleased( s32 button );
};

#endif //__INPUT_MANAGER_H__
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
